package com.lijy.vue.rest.entity;

public class Result<T> {

    private int code=200;
    private String msg;
    private T data;

    public Result() {
    }

    public Result(T data) {
        this.data = data;
    }

    public static <T> Result<T> success(T data){
        Result result=new Result<>();
        result.data=data;
        return result;
    }

    public static <T> Result<T> fail(int code,String msg){
        Result result=new Result<>();
        result.msg=msg;
        result.code=code;
        return result;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
